package com.tmc.util;

import java.awt.image.BufferedImage;
import java.util.Hashtable;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;

public class QrCodeUtil {
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static BufferedImage createWXPay(String orderNum, Double money) throws Exception {
		String text = "weixin锛�//wxpay/bizpayurl?appid=wx2421b1c4370ec43b&mch_id=10000100&nonce_str=f6808210402125e30663234f94c87a8c&product_id=1&time_stamp=1415949957&sign=512F68131DD251DA4A45DA79CC7EFE9D";
		int width = 200;
		int height = 200;
		Hashtable hints = new Hashtable();
		hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
		BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height, hints);
		return null;
		//return MatrixToImageWriter.toBufferedImage(bitMatrix);
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static BufferedImage createAliPay(String orderNum, Double totalAmount) throws Exception {
		String text = "weixin锛�//alipay/bizpayurl?appid=1234567&mch_id=12131414&nonce_str=f6808210402125e30663234f94c87a8c&product_id=1&time_stamp=1415949957&sign=512F68131DD251DA4A45DA79CC7EFE9D";
		int width = 200;
		int height = 200;
		Hashtable hints = new Hashtable();
		hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
		BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height, hints);
		return null;
		//return MatrixToImageWriter.toBufferedImage(bitMatrix);
	}
}
